package com.swu.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.swu.model.User;
import com.swu.service.UserService;

@Controller  
public class UserController {  

    @Resource
    private UserService userService; 

    @RequestMapping("/select")    
    public ModelAndView getIndex(){      
        ModelAndView mv = new ModelAndView(); 
        User user = userService.selectUserById(1);
        System.out.println(user.getUserName()+"--------------------");
        mv.setViewName("NewFile");
        mv.addObject("user", user); 
        return mv; 
    }    
}